import {
  FlowNodeInputTypeEnum,
  FlowNodeOutputTypeEnum,
  FlowNodeTemplateTypeEnum,
  FlowNodeTypeEnum,
  NodeInputKeyEnum,
  NodeOutputKeyEnum,
  WorkflowIOValueTypeEnum,
} from '@/types/workflow/constant';
import { FlowNodeTemplateType } from '@/types/workflow/node';
import { getHandleConfig } from '../../utils';
import { Input_Template_Stream_MODE } from '../../input';

export const FeishuRobotModule: FlowNodeTemplateType = {
  id: FlowNodeTypeEnum.feishuRobot,
  templateType: FlowNodeTemplateTypeEnum.communication,
  flowNodeType: FlowNodeTypeEnum.pluginModule,
  sourceHandle: getHandleConfig(true, true, true, true),
  targetHandle: getHandleConfig(true, true, true, true),
  avatar: 'feishu.svg',
  name: '飞书机器人',
  intro: '一个用于向飞书群机器人webhook发送群消息插件。',
  showStatus: false,
  isTool: true,
  courseUrl: '/docs/workflow/modules/ai_chat/',
  version: '481',
  isFolded: true,
  pluginId: 'community-feishu',
  inputs: [
    // Input_Template_Stream_MODE,
    {
      key: NodeInputKeyEnum.contextExtractInput,
      renderTypeList: [FlowNodeInputTypeEnum.reference],
      label: '需要发送的消息',
      value: '',
      valueType: WorkflowIOValueTypeEnum.string,
      selectedTypeIndex: 0,
      canEdit: false,
      required: true,
    },
    {
      key: NodeInputKeyEnum.hookUrl,
      renderTypeList: [FlowNodeInputTypeEnum.input],
      label: '飞书机器人地址',
      required: true,
      value: '',
      valueType: WorkflowIOValueTypeEnum.string,
      selectedTypeIndex: 0,
      canEdit: false,
      defaultValue: '',
    },
  ],
  outputs: [
    {
      id: NodeOutputKeyEnum.result,
      key: NodeOutputKeyEnum.result,
      label: 'webhook请求结果',
      description: '向飞书群机器人webhook发送群消息的请求结果',
      valueType: WorkflowIOValueTypeEnum.object,
      type: FlowNodeOutputTypeEnum.static,
    },
  ],
};
